package com.party.admin.task;

import com.party.admin.biz.system.MemberBizService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Enumeration;

/**
 * 万象优图
 * Created by Juliana
 *
 * @date 2017/7/7
 * @time 15:25
 */
@Component(value = "quartzRemotePicToCloud")
public class QuartzRemotePicToCloud {

    @Value("#{cos['cos.bucket']}")
    private String BUCKET;

    @Autowired
    private MemberBizService memberBizService;

    protected static Logger logger = LoggerFactory.getLogger(QuartzRemotePicToCloud.class);


    /**
     * 更新远程路径为万象优图路径
     */
    public void refresh(){
        logger.info("更新远程路径为万象优图路径定时任务启动"+BUCKET);
        try {
            // 正式环境才更新
            if(BUCKET.equals("txzapp")) {
                memberBizService.updateMemberLogoToCloud(1000);
            }
        } catch (Exception e) {
            logger.debug("更新远程路径为万象优图路径定时任务启动异常", e);
        }
    }
}
